﻿/**
 * Created by 橘色橙子 on 17/7/14.
 */
$(function () {
    // 登录处理
    $('#btn').click(function () {
        var name = $('.name').val();
        var password = $('.password').val();
        if (name == '' || password == '') {
            return
        }
        
        $.ajax({
            type: "post",
            url: "/admin/login",
            data: {
                'username': name,
                'password': password
            },
            success: function (data) {
                if (data.status == 'permission deny ！！！') {
                    layer.msg('账户已禁用，请联系管理员', {icon: 8, time: 500})
                }
                else if (data.status == 'error') {
                    layer.msg('账号或密码不正确，请重新输入', {icon: 8, time: 500})
                }
                else if (data.status == 'success') {
                    layer.msg('登录成功', {icon: 6, time: 500}, function () {
                        location.href = '/admin/index.html'
                    })
                }
            }
        });
    });
});